package com.yanqu.road.logcollector.config;

import org.springframework.context.ConfigurableApplicationContext;

import java.util.ArrayList;
import java.util.List;

public class ConfigBeans {

    private static ConfigurableApplicationContext context;

    public static void init(ConfigurableApplicationContext context) {
        ConfigBeans.context = context;
    }
    private static List<Object> configBeans = new ArrayList<>();

    public static void addConfigBean(Object object) {
        configBeans.add(object);
    }

    public static <T> T getConfigBean(Class<T> clazz) {
        return context.getBean(clazz);
    }

    public static ConfigurableApplicationContext getContext() {
        return context;
    }
}
